package lagou.homework.lagouhomework.Unit4.code.q2;

import java.io.File;
import java.io.IOException;

public class Files {
    public static void createFiles(String path, String name) {
        File f1 = new File(path, name);
        if (!f1.exists()) {
            try {
                System.out.println(f1.createNewFile() ? "文件创建成功" : "文件创建失败！");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void deleteFiles(String name) {
        File f2 = new File(name);
        if (f2.exists()) {
            System.out.println(f2.delete() ? "文件删除成功" : "文件删除失败");
        }
    }

}


